Skip to content

feat: add baseline package tests and private-safe security audit - #5

Merged
seonghobae merged 4 commits into
masterfrom
chore/governance-quality-hardening
Feb 15, 2026
Merged

feat: add baseline package tests and private-safe security audit#5
seonghobae merged 4 commits into
masterfrom
chore/governance-quality-hardening

Conversation

@seonghobae

@seonghobae seonghobae commented Feb 14, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • add baseline testthat harness so package checks exercise at least one exported API path
  • add private-repo-safe security audit workflow (gitleaks + actionlint) to keep security checks active without GHAS
  • tighten package metadata/build ignore and docs to reduce check noise and align governance docs

Validation

  • python3 -m yamllint .yamllint.yml .github/dependabot.yml .github/workflows/*.yml
  • actionlint
  • PYTHONPATH="$HOME/.config/opencode" python -m scripts.lint_by_filetype --json
  • Rscript -e "options(repos = c(CRAN="https://cloud.r-project.org")); rcmdcheck::rcmdcheck(args = c("--no-manual", "--as-cran"), error_on = "error")"

Risk

  • no algorithmic logic change intended; only docs/metadata/tests/workflow hardening
  • known legacy codetools notes in R/aFIPC.R remain and are tracked separately

@coderabbitai

coderabbitai Bot commented Feb 14, 2026

Copy link
Copy Markdown

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Summary by CodeRabbit

릴리스 노트

  • New Features

    • 보안 감사 워크플로우 추가
  • Bug Fixes

    • 오류 처리 및 복원력 강화
  • Tests

    • 테스트 프레임워크 설정 및 유닛 테스트 추가
  • Documentation

    • CI/보안 관련 문서 업데이트
    • 매개변수 설명 개선
  • Chores

    • 빌드 무시 패턴 확장
    • 보안 설정 파일 추가
    • 테스트 환경 설정 변경

Walkthrough

보안 감사 워크플로우(gitleaks/actionlint) 및 관련 설정 추가, 테스트 인프라(testthat) 도입, DESCRIPTION·문서 업데이트, 그리고 R/aFIPC.R의 모델 적합 로직에 대한 방어적 재시도/오류 처리 강화가 포함됩니다.

Changes

Cohort / File(s) Summary
Security Infrastructure
/.Rbuildignore, /.github/workflows/security-audit.yml, /.gitleaks.toml
보안 감사 GitHub Actions 워크플로우 추가(푸시/PR에서 gitleaks·actionlint 실행) 및 gitleaks 설정과 빌드 아티팩트 무시 패턴 추가.
Test Infrastructure
tests/testthat.R, tests/testthat/test-package-api.R
testthat 초기화 파일과 autoFIPC가 패키지에 내보내졌는지 확인하는 단위 테스트 추가.
Package Configuration
/DESCRIPTION
Author 라인 제거, LazyData 대체로 Config/testthat/edition: 3 추가, Suggests: testthat (>= 3.0.0) 추가.
Documentation
README.md, ARCHITECTURE.md, man/autoFIPC.Rd
보안 감사 워크플로우·gitleaks 항목 문서화 및 ... 인수 설명(예비) 업데이트.
Core Logic
R/aFIPC.R
mirt() 호출에 대한 try/재시도(while) 로직 도입, 실패 시 대체 추정(MHRM 등) 경로 확장, 상세한 메시지·출력 포맷 및 IPD/링크 처리 흐름 보강(대규모 변경).

Sequence Diagram(s)

sequenceDiagram
    participant Dev as Developer (push/PR)
    participant GH as GitHub Actions
    participant Runner as Hardened Runner
    participant Gitleaks as gitleaks
    participant Actionlint as actionlint
    participant Repo as Repository

    Dev->>GH: push/PR to main/master
    GH->>Runner: start workflow (security-audit)
    Runner->>Repo: checkout code
    Runner->>Gitleaks: install & run gitleaks --config .gitleaks.toml
    Gitleaks-->>Runner: scan results
    Runner->>Actionlint: download & run actionlint on .github/workflows
    Actionlint-->>Runner: lint results
    Runner-->>GH: report status (success/failure)
    GH-->>Dev: workflow status/annotations
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

Poem

🐰 비밀을 훑고 코드도 시험해,
재시도하며 튼튼히 잇는 발자국,
작은 당근처럼 값진 안전,
테스트와 감사에 깡총깡총 춤을 춰요.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title 'feat: add baseline package tests and private-safe security audit' accurately and clearly summarizes the main changes: adding tests and a security audit workflow.
Description check ✅ Passed The description clearly relates to the changeset, covering all major changes including test harness, security audit workflow, metadata tightening, and validation approach.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Merge Conflict Detection ✅ Passed ✅ No merge conflicts detected when merging into master

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch chore/governance-quality-hardening

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3df121cbaa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/security-audit.yml Outdated

- name: Validate workflows
run: |
curl -sSL https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash | bash -s -- 1.7.10

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Pin actionlint installer script to immutable revision

This step pipes and executes https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash, so every run trusts whatever is on the moving main branch at that moment; if upstream changes or is compromised, CI will execute unreviewed code and private-repo source can be exposed from the runner. This also conflicts with the pinned-workflow guardrail in /workspace/aFIPC/AGENTS.md ("Keep .github/workflows/ green and action SHAs pinned"). Use a commit-pinned URL (or vendor the script) so the executed installer is reproducible and auditable.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved by removing the mutable installer-script pipeline from main and using versioned release assets with checksum verification.

@seonghobae

Copy link
Copy Markdown
Collaborator Author

PR checks evidence

Required checks

  • Command: gh pr checks 5 --required --watch --fail-fast
  • Result:
    • check: pass
    • quality: pass
    • secret-and-workflow-audit: pass

Merge state

  • Command: gh pr view 5 --json mergeStateStatus,mergeable,reviewDecision,url
  • Result: mergeStateStatus=BLOCKED, mergeable=MERGEABLE, reviewDecision=(empty; approval required by ruleset)

Effective branch rules (master)

  • Command: gh api repos/seonghobae/aFIPC/rules/branches/master
  • Result: deletion + non_fast_forward + pull_request + required_status_checks
  • required_status_checks contexts: check, quality, secret-and-workflow-audit

Code scanning API state

  • Command: gh api /repos/seonghobae/aFIPC/code-scanning/analyses?pr=5
  • Result: HTTP 403 (Code scanning is not enabled for this repository)
  • Command: gh api /repos/seonghobae/aFIPC/code-scanning/alerts?pr=5&state=open
  • Result: HTTP 403 (Code scanning is not enabled for this repository)

Head check-runs

  • Command: gh api /repos/seonghobae/aFIPC/commits/<HEAD_SHA>/check-runs
  • Result summary:
    • check: success
    • quality: success
    • secret-and-workflow-audit: success
    • dependency-review: skipped (private repo guard)
    • Analyze (actions): skipped (private repo guard)

@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Feb 14, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

1 similar comment
@coderabbitai

coderabbitai Bot commented Feb 14, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

coderabbitai[bot]
coderabbitai Bot previously requested changes Feb 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
R/aFIPC.R (1)

101-118: ⚠️ Potential issue | 🟠 Major

비정상 입력 처리에서 undefined 함수 호출.
숫자가 아닌 입력 시 readinteger()가 호출되는데 정의가 없어 즉시 실패합니다. 동일 함수로 재질의하도록 수정하세요.

🛠️ 수정 제안
-          if (!grepl("^[0-9]+$", n)) {
-            return(readinteger())
-          }
+          if (!grepl("^[0-9]+$", n)) {
+            return(checkoldformBILOGprior())
+          }
🤖 Fix all issues with AI agents
In @.github/workflows/security-audit.yml:
- Around line 25-38: The workflow currently downloads and runs external binaries
without integrity checks; update the "Install gitleaks" and "Validate workflows"
steps to fetch and verify release checksums (or signatures) before execution:
for the gitleaks step (refer to the "Install gitleaks" and subsequent
"./gitleaks detect" usage) download the official checksum (e.g., SHA256SUMS or
.sha256) for v8.24.2 from the gitleaks release, verify the tarball with
sha256sum (or gpg verify if a signature is provided) and fail the job if
verification fails, then extract and chmod only after verification; for
actionlint (the script piped from rhysd/actionlint and the "./actionlint"
invocation in "Validate workflows") either download a released artifact and its
checksum/signature and verify before running or fetch the script plus the
published checksum/signature and validate the downloaded binary/version matches
the checksum, aborting on mismatch.

In `@R/aFIPC.R`:
- Around line 200-215: The while loop that repeatedly calls mirt::mirt to create
oldFormModel can loop forever if model fitting keeps failing; modify the code
around oldFormModel (the try + while (!exists('oldFormModel')) block that calls
mirt::mirt with data = oldformYDataK and itemtype = itemtype) to implement a
bounded retry: introduce a max_retries counter (e.g., 5–10), increment an
attempt counter on each failure, catch and store the error from mirt::mirt, add
a short backoff (Sys.sleep) between attempts, and after exceeding max_retries
stop retrying and handle the failure (log or return a clear error/NA) instead of
spinning; apply the same change to the analogous block that creates the new form
model.
- Around line 137-165: The code wraps mirt::mirt calls in try() (e.g. the
assignment to oldFormModel via mirt::mirt) but never checks whether the call
actually returned a valid model before later accessing slots like `@OptimInfo`;
update the try usage to capture the result (e.g. store try(...) into a variable
or use tryCatch), verify the object is a valid mirt model (or non-NULL) after
the call, and if it failed either stop with a clear error or branch to a
fallback path (same fix for oldFormModel and the corresponding newFormModel
block around the second mirt call); reference oldFormModel, mirt::mirt, and
`@OptimInfo` when making the check and handling failure.
- Around line 590-597: The code unconditionally removes parameters matching
"^ak" from IPDParmNames, which incorrectly excludes ak* for nominal items;
update the logic around the IPDParmNames filtering so that ak parameters are
only removed when the item's type is not "nominal" (i.e., check the itemtype or
a variable indicating nominal vs non-nominal before applying the grep("^ak",
IPDParmNames) removal), keeping the existing removals for "^MEAN", "^COV", and
"^d0$" unchanged and only conditionally including grep("^ak", IPDParmNames) in
the subtraction when itemtype != "nominal".

Comment thread .github/workflows/security-audit.yml
Comment thread R/aFIPC.R
Comment thread R/aFIPC.R
Comment thread R/aFIPC.R
coderabbitai[bot]
coderabbitai Bot previously requested changes Feb 14, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@R/aFIPC.R`:
- Around line 101-108: The function checkoldformBILOGprior calls an undefined
readinteger(), causing a runtime error; change the error branch to recursively
call checkoldformBILOGprior() (matching the pattern used in checkCorrect and
checknewformBILOGprior) so invalid input re-prompts correctly and returns the
validated value from checkoldformBILOGprior().

Comment thread R/aFIPC.R
@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Feb 15, 2026

Copy link
Copy Markdown
✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai resolve

@seonghobae

Copy link
Copy Markdown
Collaborator Author

@coderabbitai full review

@coderabbitai

coderabbitai Bot commented Feb 15, 2026

Copy link
Copy Markdown
✅ Actions performed

Full review triggered.

@seonghobae
seonghobae dismissed stale reviews from coderabbitai[bot] and coderabbitai[bot] February 15, 2026 03:35

Addressed or triaged in-thread for solo-maintained compatibility constraints.

@seonghobae
seonghobae merged commit 0e9a1b7 into master Feb 15, 2026
5 checks passed
@seonghobae
seonghobae deleted the chore/governance-quality-hardening branch February 15, 2026 03:35
@coderabbitai

coderabbitai Bot commented Feb 15, 2026

Copy link
Copy Markdown
✅ Actions performed

Comments resolved and changes approved.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant